import Vue from "vue";
import Router from "vue-router";
import Login from "./views/Login";
import NotFound from "./views/404";
import Home from "./views/Home";
import Main from "./views/Main";
import User from "./views/User";
import Table from "./views/nav1/Table";
import Form from "./views/nav1/Form";
import user from "./views/nav1/user";
import Page4 from "./views/nav2/Page4";
import Page5 from "./views/nav2/Page5";
import Page6 from "./views/nav3/Page6";
import echarts from "./views/charts/echarts";


Vue.use(Router);

export default new Router({
  mode: "history",
  base: process.env.BASE_URL,
  routes: [
    {
      path: "/",
      name: "login",
      component: Login,
      hidden: true
    },
    {
      path: "/404",
      name: 'error',
      component: NotFound,
      hidden: true
    },
    {
      path: "/",
      name: "getway",
      component: Home,
      iconCls: 'el-icon-message',
      children: [
        // 当"/main" 路径被匹配到时就会在<router-view>中渲染Main和父路由home， path"/" 表示默认; 页面中通过hidden属性判断是否展示
        {path: "/table", component: Table, name: "table", hidden: false},
        {path: "/form", component: Form, name: "form", hidden: false},
        {path: "/user", component: User, name: "user", hidden: false}
      ]
    },
    {
      path: '/',
      component: Home,
      name: 'menu',
      iconCls: 'fa fa-id-card-o',

      children: [
        { path: '/page4', component: Page4, name: 'page4' },
        { path: '/page5', component: Page5, name: 'page5' }
      ]
    },
    {
      path: '/',
      component: Home,
      name: '',
      iconCls: 'fa fa-address-card',
      leaf: true,// 只有一个节点
      children: [
        { path: '/page6', component: Page6, name: 'test' }
      ]
    },
    {
      path: '/',
      component: Home,
      name: 'Charts',
      iconCls: 'fa fa-bar-chart',
      children: [
        { path: '/echarts', component: echarts, name: 'echarts' }
      ]
    },
    {
      path: '*',
      hidden: true,
      redirect: { path: '/404' }
    }
  ]
});
